package phapp.service.barapp.impl;

import static javacommon.util.Struts2JsonHelper.outJson;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONObject;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import cn.org.rapid_framework.page.Page;
import cn.org.rapid_framework.page.PageRequest;
import javacommon.base.*;

import phapp.model.barapp.*;
import phapp.dao.barapp.*;
import phapp.service.barapp.impl.*;
import phapp.service.barapp.*;
/**
 * <p> 标题: 会员主信息表, tc_vip_main_info  业务处理层
 * <p>Description: spring事务实现层,调用Dao层取数据
 * <p>Copyright: Copyright (c) 2014-10
 * <p>Company: 
 * @see phapp.model.barapp.VipMain
 * @see phapp.service.barapp.VipMainManager
 * @see phapp.dao.barapp.VipMainDao
 * @author you name
 * @version 1.0
*/

@Component("vipMainManager")
@Transactional
public class VipMainManagerImpl extends BaseManager<VipMain,java.lang.Integer>
               implements VipMainManager {

   /**定义Dao*/
   private VipMainDao vipMainDao;
   /**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性*/
   public void setVipMainDao(VipMainDao dao) {
      this.vipMainDao = dao;
   }

   /**获取Dao*/
   public EntityDao getEntityDao() {
      return this.vipMainDao;
   }

   /**
   * <p>分页查询VipMain<br>
   * @param PageRequest pr
   * @return Page
   * @author
   */
   @Transactional(readOnly=true)
   public Page findByPageRequest(PageRequest pr) {
      return vipMainDao.findByPageRequest(pr);
   }

   /**
   * <p>批量删除 VipMain<br>
   * @param VipMain u
   * @return Boolean
   * @author
   */
   public Boolean  removeByIdArry(VipMain u) {
      Boolean result =false;
      int i =-1,size=u.getIdList().size();
      i =vipMainDao.removeByIdArry(u);
      if(i==size){
         result =true;
      }else{
         throw new RuntimeException();
      }
      return result;
   }
	/**
	* <p> Bean查询 <br> 
	* @param VipMain bean
	* @return  VipMain
	* @author
	*/

	/**
	* <p>按Bean查询返回List<br> 
	* @param VipMain bean
	* @return List
	* @author
	*/
	public java.util.List  findListByBean(VipMain u) { 
		java.util.List<VipMain> list =  vipMainDao.findListByBean(u); 
	      return list;
	}
    /**
     * <p>标题: 查询所有会员,返回列表
     * <p>参数:
     * <p>返回:
     */
    public java.util.List  getVipAllList(java.util.Map map) {
    	java.util.List<VipMain> list =  vipMainDao.getVipAllList(map);
    	return list;
    }
    /**
     * <p>标题: 会员注册
     * <p>参数: String sex:性别:1男,2女,String menberName:手机号码,String code:验证码
     * <p>参数: String menberPass:密码,String nickname:昵称,String file:头像文件,String imei:手机MIME码
     * <p>返回: boolean true 成功,false 失败
     */
    public boolean vipReg(java.util.Map map){
    	vipMainDao.vipReg(map);
    	return true;
    }
    /**
     * <p>通过Map 数据类修改一条VipMain数据<br> 
     * @param Map map 
     */
    public int updateByMap(java.util.Map map){
    	return vipMainDao.updateByMap(map);
    }
    /**
     * <p>标题: 个人资料修改
     * <p>参数: String userJson
     * <p>参数: 
     * <p>返回: {"msg":"成功","success":true}
     * @throws Exception
     */
	public boolean  updataVip(VipMain u){
    	/**包含头的个人资料修改*/
		vipMainDao.update(u);
		
		/**修改相册*/
    	 return true;
	}

	/**
	 * <p>标题: 查询我的好友列表
	 * <p>参数: String menberId 会员ID,String sex:性别:1男,2女, String limit:取前多少条
	 * <p>返回: List<VipMain>
	*/
	public List<VipMain> myFriendList(java.util.Map map){ 
		List<VipMain> list = vipMainDao.myFriendList(map);
		return list;
	}
	
	/**
	 * <p>标题:  
	 * <p>参数:  
	 * <p>返回:  
	*/
	public int updataByMap(java.util.Map map){
		int list = vipMainDao.updataByMap(map);
		return list;
	}
	
}
